﻿using UnityEngine;
using System.Collections;

public abstract class BaseFieldItem : MonoBehaviour
{
	void OnTriggerEnter2D(Collider2D coll)
	{
		BaseCharacter character	= coll.gameObject.GetComponent<BaseCharacter>();
		if(character != null && character.faction == Faction.Allies)	// * 아군 캐릭터와 닿은 경우만 작동
		{
			OnObtained(character);
			GameObject.Destroy(gameObject);								// 먹은 직후엔 사라진다
		}
	}

	public abstract void OnObtained(BaseCharacter obtainer);
}
